import Mock from 'mockjs'


let data1 = Mock.mock({
    'data': [
        {
            'codenum': '@zip'
        }
    ]
})

Mock.mock('/codenums', 'get', () => {
    return data1
})

// 预约
let data2 = Mock.mock({
    'data': []
})

Mock.mock('/addreservation', 'post', (config) => {
    // console.log(config.body);
    data2.data.push(JSON.parse(config.body))
    return data2.data
})

Mock.mock('/deletereservation', 'post', (config) => {
    let data = JSON.parse(config.body)
    data2 = data2.data.filter((item: { doctorname: any; kinds: any; hospital: any; visitor: any; gender: any; age: any; position: any }) => item.doctorname !== data.doctorname && item.kinds !== data.kinds && item.hospital !== data.hospital && item.visitor !== data.visitor && item.gender !== data.gender && item.age !== data.age && item.position !== data.position)
    return data2
})